/**
 */
package com.eplatform.modules.sys.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.eplatform.common.persistence.Page;
import com.eplatform.common.utils.EhCacheUtils;
import com.eplatform.common.web.BaseController;
import com.eplatform.modules.sys.entity.Log;
import com.eplatform.modules.sys.entity.User;
import com.eplatform.modules.sys.service.LogService;
import com.eplatform.modules.sys.utils.UserUtils;

/**
 * 缓存Controller
 * @author admin
 * @version 2013-6-2
 */
@Controller
@RequestMapping(value = "${adminPath}/sys/cache")
public class CacheController extends BaseController {

	@Autowired
	private LogService logService;
	
	@RequestMapping(value ="clearAll")
	@ResponseBody
	public String clearAll(HttpServletRequest request, HttpServletResponse response, Model model) {
        User user=UserUtils.getUser();
        String result="";
        if(user.isAdmin()){
        	result="超管用户，即将清理缓存";
        	EhCacheUtils.clearAll();
        }
        return "缓存清理完毕";
	}

}
